var express = require('express');
var router = express.Router();
var UserController = require("../controller/user_ctr")

router.use(function (req, res, next) {
    next()
});

router.post('/regist', function (req, res, next) {
    let u = new UserController()
    u.Regist(req.body, (err, result) => {
        res.json(result)
    })
});

router.post('/login', function (req, res, next) {
    let u = new UserController()
    u.Login(req.body, (err, result) => {
        res.json(result)
    })
});

router.post('/update', function (req, res, next) {
    let u = new UserController()
    u.Update(req.body, (err, result) => {
        res.json(result)
    })
});

router.get('/profile', function (req, res, next) {
    let u = new UserController()
    u.Detail(req.body, (err, result) => {
        res.json(result)
    })
});

router.get('/list', function (req, res, next) {
    let u = new UserController()
    u.List(req.body, (err, result) => {
        res.json(result)
    })
});

module.exports = router;